package wei.qiang.ye.springcomponentdemo.config;

import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.FilterType;
import org.springframework.stereotype.Repository;
import org.springframework.web.bind.annotation.RestController;
import wei.qiang.ye.springcomponentdemo.domain.Order;

@Configuration
/**
 * 1.根据注解来排除（type = FilterType.ANNOTATION）,这些注解的类型为classes = {RestController.class, Repository.class}。
 *    即Controller和Repository注解标注的类不再被纳入到IOC容器中。
 * 2.根据指定类型类排除（type = FilterType.ASSIGNABLE_TYPE），排除类型为Order.class，其子类，实现类都会被排除。
 */
//base-package指定了扫描的路径。路径下所有被@Controller、@Service、@Repository和@Component注解标注的类都会被纳入IOC容器中。
@ComponentScan(value = "wei.qiang.ye.springcomponentdemo",
 excludeFilters = {
    @ComponentScan.Filter(type=FilterType.ASSIGNABLE_TYPE ,classes = Order.class),
         @ComponentScan.Filter(type = FilterType.ANNOTATION, classes = {RestController.class, Repository.class})
 })
public class WebConfig2 {

}